using System;
using System.Resources;
using System.Text;
using System.Reflection;
using System.Globalization;
using System.Windows.Forms;

namespace MultiLang
{
  internal class ml
  {
    private static string RootNamespace = "Rsdn.Janus" ; //MLHIDE
    private static ResourceManager   ResMgr ;

    static ml()
    {
      if ( RootNamespace.Length > 0 )
        ResMgr = new ResourceManager ( RootNamespace + ".MultiLang", Assembly.GetExecutingAssembly ( ) ) ; //MLHIDE
      else
        ResMgr = new ResourceManager ( "MultiLang", Assembly.GetExecutingAssembly ( ) );                   //MLHIDE
    }

    public static void ml_UseCulture ( CultureInfo ci )
    {
      System.Threading.Thread.CurrentThread.CurrentUICulture = ci ;
    }
    
    public static string ml_string ( int StringID, string Text )
    {
      return ml_resource ( StringID ) ;
    }

    public static string ml_resource ( int StringID )
    {
      return ResMgr.GetString ( "_" + StringID.ToString() ) ;
    }
    public static string[] SupportedCultures = { "en", "ru" } ; //MLHIDE
  }

  public class ml_JanusDisplayNameAttribute : Rsdn.Janus.JanusDisplayNameAttribute
  {
    public ml_JanusDisplayNameAttribute( int stringId, string text )
      : base ( ml.ml_string ( stringId, text ) )
    {
    }
  }

  public class ml_CategoryAttribute : System.ComponentModel.CategoryAttribute
  {
    public ml_CategoryAttribute( int stringId, string text )
      : base ( ml.ml_string ( stringId, text ) )
    {
    }
  }

  public class ml_DescriptionAttribute : System.ComponentModel.DescriptionAttribute
  {
      public ml_DescriptionAttribute(int stringId, string text)
          : base(ml.ml_string(stringId, text))
      {
      }
  }

  public class ml_MethodShortcutAttribute : Rsdn.Shortcuts.MethodShortcutAttribute
  {
      public ml_MethodShortcutAttribute(Shortcut key, int stringId, string text, int stringId2, string text2)
          : base(key, ml.ml_string(stringId, text), ml.ml_string(stringId2, text2))
    {
    }
  }

  public class ml_NullValueAttribute : BLToolkit.Mapping.NullValueAttribute
  {
    public ml_NullValueAttribute( int StringID, string Text )
      : base ( ml.ml_string ( StringID, Text ) )
    {
    }
  }
}
